import { PageTool } from "../../../common/global/PageTool";
import { DataProvider } from "../../../../fl/data/DataProvider";
import { SRobIslandGuildFightingInfo } from "../../../../Message/Game/SRobIslandGuildFightingInfo";
import { GlobalStyle } from "../../../common/global/GlobalStyle";
import { ObjCreate } from "../common/ObjCreate";
import { Language } from "../../../../extend/language/Language";
import { ImagesConst } from "../../resource/ImagesConst";
import { ScrollPolicy } from "../../../../fl/controls/ScrollPolicy";
import { PetIslandSituationInfoItemRenderer } from "./renderer/PetIslandSituationInfoItemRenderer";
import { PageSelecter } from "../common/pageSelect/PageSelecter";
import { GTileList } from "../../../../com/mui/controls/GTileList";
//class PetIslandSituationPanel
    
    export  class PetIslandSituationPanel /* flash.display.Sprite */
    {
        constructor()
        {
            
            this._pageTool = new PageTool([], 12);
            this.init();
            return;
        }

        /* internal  */onEquipmentPageChange(arg1: Object /* flash.events.Event */=null): void
        {
            var loc1=this._pageSelecter.currentPage;
            this._list.dataProvider = new DataProvider(this._pageTool.getByPageNo(loc1));
            this._list.drawNow();
            return;
        }

        public set data(arg1: SRobIslandGuildFightingInfo)
        {
            this._pageTool.array = arg1.fightings;
            this._pageSelecter.currentPage = this._pageTool.currentPage;
            this._pageSelecter.maxPage = this._pageTool.pagesCount;
            this._list.dataProvider = new DataProvider(this._pageTool.getByPageNo(this._pageSelecter.currentPage));
            this._list.drawNow();
            return;
        }

        /* internal  */init(): void
        {
            var loc1=GlobalStyle.setTextFormatAlign(GlobalStyle._textFormat2, flash.text.TextFormatAlign.CENTER);
            ObjCreate.createGTextField(Language.getString(28138), 0, 30, 110, 20, this, loc1);
            ObjCreate.createGTextField(Language.getString(28139), 110, 30, 130, 20, this, loc1);
            ObjCreate.createGTextField(Language.getString(28140), 240, 30, 110, 20, this, loc1);
            ObjCreate.createGTextField(Language.getString(28141), 350, 30, 110, 20, this, loc1);
            ObjCreate.createGTextField(Language.getString(28142), 435, 30, 100, 20, this, loc1);
            ObjCreate.createBg(3, 52, 550, 2, this, ImagesConst.SplitLine);
            this._list = ObjCreate.createTileList(0, 54, 560, 405, this);
            this._list.scrollPolicy = ScrollPolicy.OFF;
            this._list.columnWidth = 560;
            this._list.rowHeight = 33;
            this._list.setStyle("cellRenderer", PetIslandSituationInfoItemRenderer);
            this._pageSelecter = ObjCreate.createPageSelecter(200, 467, this);
            this._pageSelecter.mode = PageSelecter.CompleteMode;
            this._pageSelecter.addEventListener(flash.events.Event.CHANGE, this.onEquipmentPageChange);
            return;
        }

        /* internal */ /* var */_list: GTileList;

        /* internal */ /* var */_pageSelecter: PageSelecter;

        /* internal */ /* var */_pageTool: PageTool;
    }
